#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

template<typename T=int>
inline T read() {
    T x;
    cin >> x;
    return x;
}

int a[10000 + 1], n;

/**
 * 插入排序的递归实现
 * @param a
 * @param left
 * @param right
 */
void insert_sort(int *a, int left, int right) {
    if (left >= right)return;
    insert_sort(a, left, right - 1);
    int p = upper_bound(a + left, a + right, a[right]) - a;
    if (p == right)return;
    int t = a[right];
    for (int i = right; i > p; i--) {
        a[i] = a[i - 1];

    }
    a[p] = t;

}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n;
    for (int i = 0; i < n; i++)cin >> a[i];
    insert_sort(a, 0, n - 1);
    copy(a, a + n, ostream_iterator<int>(cout, " "));
    cout << endl;


    return 0;
}
